import request from '@/utils/request';
const AUTH_BASE_URL = '/nljs/form';

const FormDataAPI = {
  // 新增表单数据
  addFormData(data: any) {
    return request({
      url: `${AUTH_BASE_URL}/data`,
      method: 'post',
      data,
    });
  },
  // 修改表单数据
  updateFormData(data: any) {
    return request({
      url: `${AUTH_BASE_URL}/data/update`,
      method: 'post',
      data,
    });
  },

  // 获取填报记录表单数据
  getFormDataByRecordId(id: string | number) {
    return request({
      url: `${AUTH_BASE_URL}/data/record/${id}`,
      method: 'get',
    });
  },

  // 获取表单数据详情
  getFormDataById(id: string | number) {
    return request({
      url: `${AUTH_BASE_URL}/data/${id}`,
      method: 'get',
    });
  },
  // 导出表单数据
  exportFormData(id: any) {
    return request({
      url: `${AUTH_BASE_URL}/data/${id}/export-excel`,
      method: 'get',
      responseType: 'blob',
    });
  },
};

export default FormDataAPI;
